{% extends "two_column_body.html" %}
{% import "macros.html" as macros %}
<!-- user_edit.html -->
{% block title %}{% spaceless %}{% trans %}Edit user profile{% endtrans %}{% endspaceless %}{% endblock %}
{% block content %}
<h1 class="section-title">
    {{ request.user.username|escape }} - {% trans %}edit profile{% endtrans %}
</h1>
<div id="main-body" class="edit-pane">
    <form name="" action="{% url edit_user request.user.id %}" method="post">{% csrf_token %}
        <div id="edit-user">
            <h2>{% trans %}Registered user{% endtrans %}</h2>
            <table width="100%">
                <tr id="mobile-invisible-avatar">
                    <td colspan="2">
                        <div id="edit-user-left" style="float:left; padding-right: 2em">
                            <div class='avatar'>
                                {{ macros.gravatar(view_user, 128) }}
                                {% if request.user == view_user %}
                                    <p style="margin-top: 0.5em; margin-bottom: 1em"><a style="font-weight: bold; text-decoration: none; color: #3c6eb4;"
                                        {% if support_custom_avatars %}
                                            href="{% url avatar_change %}"
                                        {% else %}
                                            href="{% url faq %}#gravatar"
                                        {% endif %}
                                    >{% trans %}change picture{% endtrans %}</a></p>
                                    {% if support_custom_avatars %}
                                    <p style="margin-top: 0.5em"><a style="font-weight: bold; text-decoration: none; color: #3c6eb4; margin-left: 0.8em;" href="{% url avatar_delete %}"
                                        >{% trans %}remove{% endtrans %}</a>
                                    </p>
                                    {% endif %}
                                {% endif %}
                            </div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td id="desktop-visible-avatar" style="vertical-align: top">
                        <div id="edit-user-left" style="float:left; padding-right: 2em">
                            <div class='avatar'>
                                {{ macros.gravatar(view_user, 128) }}
                                {% if request.user == view_user %}
                                    <p style="margin-top: 0.5em"><a style="font-weight: bold; text-decoration: none; color: #3c6eb4;"
                                        {% if support_custom_avatars %}
                                            href="{% url avatar_change %}"
                                        {% else %}
                                            href="{% url faq %}#gravatar"
                                        {% endif %}
                                    >{% trans %}change picture{% endtrans %}</a></p>
                                    {% if support_custom_avatars %}
                                    <p style="margin-top: 0.5em"><a style="font-weight: bold; text-decoration: none; color: #3c6eb4; margin-left: 0.8em;" href="{% url avatar_delete %}"
                                        >{% trans %}remove{% endtrans %}</a>
                                    </p>
                                    {% endif %}
                                {% endif %}
                            </div>
                        </div>
                    </td>
                    <td>
                        <table class="user-details">
                            <tr>
                                <th width="100px"></th>
                                <th></th>
                            </tr>
                            <tr>
                                <td style="width: 20%">{% trans %}Screen Name{% endtrans %}:</td>
                                <td>
                                    {% if settings.EDITABLE_SCREEN_NAME %}
                                        {{ form.username }}
                                        <span class="form-error"> {{ form.username.errors }} </span>
                                    {% else %}
                                        {{ view_user.username|escape }}
                                    {% endif %}
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    {{ form.email.label_tag() }}:
                                </td>
                                <td>
                                    {% if settings.EDITABLE_EMAIL %}
                                        {{ form.email }}
                                        <span class="form-error">{{ form.email.errors }}</span>
                                    {% else %}
                                        {{ view_user.email }}
                                        {% trans %}(cannot be changed){% endtrans %}
                                    {% endif %}
                                </td>
                            </tr>
                            <tr>
                                <td>{{ form.realname.label_tag() }}:</td>
                                <td>{{ form.realname }} <span class="form-error"> {{ form.realname.errors }} </span></td>
                            </tr>
                            <tr>
                                <td>{{ form.website.label_tag() }}:</td>
                                <td>{{ form.website }} <span class="form-error"> {{ form.website.errors }} </span></td>
                            </tr>
                            <tr>
                                <td>{{ form.city.label_tag() }}:</td>
                                <td>{{ form.city }} <span class="form-error"> {{ form.city.errors }} </span></td>
                            </tr>
                            <tr>
                                <td>{{ form.country.label_tag() }}:</td>
                                <td>{{ form.country }} <span class="form-error"> {{ form.country.errors }} </span></td>
                            </tr>
                            <tr>
                                <td>{{ form.show_country.label_tag() }}:</td>
                                <td>{{ form.show_country }} <span class="form-error"> {{ form.show_country.errors }} </span></td>
                            </tr>
                            <tr>
                                <td>{{ form.birthday.label_tag() }}:</td>
                                <td>{{ form.birthday }} <span class="form-error"> {{ form.birthday.errors }} </span></td>
                            </tr>
                            <tr>
                                <td></td>
                                <td class="title-desc">{{ form.birthday.help_text }}</td>
                            </tr>
                            <tr>
                                <td style="vertical-align:top">{{ form.about.label_tag() }}:</td>
                                <td>{{ form.about }} <span class="form-error"> {{ form.about.errors }} </span></td>
                            </tr>
                            {% if marked_tags_setting == 'when-user-wants' %}
                            <tr>
                                <td>{{ form.show_marked_tags.label_tag() }}:</td>
                                <td>{{ form.show_marked_tags }}
                                    <span class="form-error">{{ form.show_marked_tags.errors }}</span>
                                </td>
                            </tr>
                            {% endif %}
                        </table>
                    </td>
                </tr>
            </table>
            <div style="margin-top: 0.5em">
                <input class="normal-btn" type="submit" value="{% trans %}Update{% endtrans %}"/>
                <input id="cancel" class="normal-btn" type="button" value="{% trans %}Cancel{% endtrans %}"/>
            </div>
        </div>
    </form>
</div>
{% endblock %}
{% block sidebar %}{% endblock %}
{% block endjs %}
        <script type="text/javascript">
            $().ready(function(){
                $("#nav_profile").attr('className',"on");
                $("#cancel").bind('click', function(){history.go(-1);})
            });
        </script>
        {% block userjs %}
        {% endblock %}
{% endblock %}
<!-- end user_edit.html -->
